home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume23 / xenix-gnu / part01 next >
Encoding:
Text File  |  1991-09-27  |  52.7 KB  |  1,626 lines

  1. Newsgroups: comp.sources.misc
  2. From: steve@robobar.co.uk (Steve Bleazard)
  3. Subject:  v23i028:  xenix-gnu - Xenix 386 patchkit for GCC / GAS and GDB, Part01/03
  4. Message-ID: <csm-v23i028=xenix-gnu.235700@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 2c8ce197d6aed83417b22bd85b9bfbab
  6. Date: Fri, 27 Sep 1991 04:59:23 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: steve@robobar.co.uk (Steve Bleazard)
  10. Posting-number: Volume 23, Issue 28
  11. Archive-name: xenix-gnu/part01
  12. Environment: SCOXENIX
  13.  
  14. This is part 1 of a 3 part posting.
  15.  
  16. This and the following 2 parts consists of patch kits to GCC 1.40, 
  17. GAS 1.38.1 and GDB 3.5 for SCO Xenix 386.  The port was done by Steve Bleazard 
  18. <steve@robobar.co.uk> with assistance from Ronald Khoo <ronald@ibmpcug.co.uk>.
  19. Please see the file README.GCC for more information.
  20.  
  21. The patches to GCC, GAS and GDB are all covered by the GNU Public
  22. Licence, please refer to COPYING in the source to any of these programs.
  23. Richard Stallman has ask me to remind you that if you wish to distribute
  24. the binaries to any of the programs produced using these patches you
  25. must also make a *complete* source distribution available.
  26.  
  27. Steve.Bleazard@RoboBar.Co.Uk        
  28. ------
  29. #! /bin/sh
  30. # This is a shell archive.  Remove anything before this line, then feed it
  31. # into a shell via "sh file" or similar.  To overwrite existing files,
  32. # type "sh file -c".
  33. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  34. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  35. # Contents:  README.GCC gcc-1.40.pch
  36. # Wrapped by kent@sparky on Thu Sep 26 23:47:58 1991
  37. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  38. echo If this archive is complete, you will see the following message:
  39. echo '          "shar: End of archive."'
  40. if test -f 'README.GCC' -a "${1}" != "-c" ; then 
  41.   echo shar: Will not clobber existing file \"'README.GCC'\"
  42. else
  43.   echo shar: Extracting \"'README.GCC'\" \(8239 characters\)
  44.   sed "s/^X//" >'README.GCC' <<'END_OF_FILE'
  45. X# @(#) $Id: README.GCC,v 1.2 1991/08/22 20:02:56 ronald Exp $
  46. X
  47. XThis README describes the port of GNU CC to SCO XENIX 386 from RoboBar Ltd.
  48. XThis port consists of patch kits to GCC 1.40, GAS 1.38.1 and GDB 3.5
  49. XThe port was done by Steve Bleazard <steve@robobar.co.uk> with assistance
  50. Xfrom Ronald Khoo <ronald@ibmpcug.co.uk> who wrote this README and packaged
  51. Xthe kit.
  52. X
  53. XDisclaimer:  RoboBar Ltd has no connection with the Santa Cruz Operation
  54. X         whatsoever, other than being an indirect customer of theirs.
  55. X         There is no warranty, nor claim of fitness for any purpose of
  56. X         any program code you may happen to find in these files.
  57. X         Various trademarks of Intel Corp,  Microsoft Corp, and the
  58. X         Santa Cruz Operation, Inc. are mentioned in these files,
  59. X         and are hereby acknowledged.
  60. X
  61. X(C) Copyright 1991 RoboBar Ltd.  Permission is granted to redistribute
  62. X    this article without any encumbrance, other than that this copyright
  63. X    notice be retained, and that any modifications be clearly marked as such.
  64. X
  65. XOverview:
  66. X
  67. XThis port works on SCO XENIX 386.  It has been tested on:
  68. X    OS version: 2.3.4  with  Development System version 2.3.1b
  69. Xbut we believe that it should be useable with some effort on versions
  70. X2.2 and later.
  71. X
  72. XThe object file format used is the native Microsoft/Intel OMF format,
  73. X    so the GNU binutils are not used.  Therefore, this port is
  74. X    compatible with third party SCO-compatible object libraries.
  75. XThe SCO Development System provides the system libraries and include files.
  76. XThe standard Microsoft assembler is not used -- instead the GNU assembler
  77. X    was ported to produce OMF.
  78. XA linker helper-program (provided by Christoph Badura <bad@flatlin.ka.sub.org>,
  79. X    installed as /usr/local/lib/gcc-ld) helps gcc's -L -l options to work.
  80. X    However, the standard XENIX /bin/ld does the real linking--it
  81. X    is executed by Christoph's program.
  82. XSymbolic debugging is supported for the accompanying port of GDB only.
  83. X    SCO's sdb debugging format is not documented, and seems to change
  84. X    from release to release, so we can't support it.
  85. XThe port of GDB was started from an sdb-based port by rdk386!ron (Ron Kuris)
  86. X    Without his lead, this port would probably not exist.
  87. XThe GNU compiler system, as modified by these patches, serves as our
  88. X    production compiler at RoboBar.  We believe it to be of
  89. X    production quality, and in any case of much higher quality than
  90. X    SCO XENIX's native Microsoft compiler system.
  91. X
  92. XThis README documents how to compile and install this GCC port from
  93. Xthe patches alone.  You can skip some of the steps if you already
  94. Xhave XENIX GCC binaries from earlier versions of this XENIX GCC port.
  95. XIf you are building from scratch, you can use the commands indicated
  96. Xby => in this README as a guide.  On *our* system, those commands
  97. Xwere directly executed from this file via a script.  If your version
  98. Xof XENIX or the Development System is different from ours, you may
  99. Xhave to hack a bit, though.
  100. X
  101. XNote that parts of the procedure require you to be root, with a umask no
  102. Xmore paranoid than 022.
  103. X
  104. XWhat you need:
  105. X
  106. X    SCO XENIX 386 Operating System
  107. X    SCO XENIX 386 Development System
  108. X    Larry Wall's "patch" program, version 2, patchlevel 12.
  109. X        (from volume 7 of comp.sources.unix, or the GNU
  110. X         enhanced one from prep.ai.mit.edu)
  111. X    The standard GNU distributions of the compiler and assembler:
  112. X        gcc-1.40.tar.Z and gas-1.38.1.tar.Z
  113. X        (from prep.ai.mit.edu:/pub/gnu)
  114. X    The three patches in this kit:
  115. X        gcc-1.40.pch
  116. X        gas-1.38.pch
  117. X        gdb-3.5b.pch
  118. X    A modicum of free disc space.  10 Mb is comfortable.  You can
  119. X    do it with less, but the instructions here assume 10Mb free.
  120. X
  121. X    Patience.  Lots of patience.  The patience of a saint.
  122. X
  123. XWhat to do:
  124. X
  125. X    First, ensure /usr/local/bin is in your PATH, and that
  126. X    the "patch" program can be found in your path.
  127. X=>    PATH=/usr/local/bin:/bin:/usr/bin export PATH
  128. X
  129. X    Next, unpack the GNU distributions, and copy alloca.c from
  130. X    the GCC directory into the GAS directory:
  131. X
  132. X=>    zcat < gas-1.38.1.tar.Z | tar xf -
  133. X=>    zcat < gcc-1.40.tar.Z | tar xf -
  134. X=>    zcat < gdb-3.5.tar.Z | tar xf -
  135. X=>    cp gcc-1.40/alloca.c gas-1.38/alloca.c
  136. X
  137. X    Now, compile the GNU assembler with the standard compiler.
  138. X        (Do not switch the optimiser on, as this will cause
  139. X         incorrect code to be generated.  And "const" breaks it)
  140. X=>    cd gas-1.38
  141. X=>    patch < ../gas-1.38.pch
  142. X=>    cc -c alloca.c
  143. X=>    make ax386 G0="-Dconst= -DUSG -DWORKING_DOT_WORD" O1= LOADLIBES=alloca.o
  144. X
  145. X    (Throughout this build, you will get plenty of warning messages
  146. X     from the compiler.  At this stage, it is best to ignore them)
  147. X
  148. X    Now, install the assembler as /usr/local/lib/gcc-as
  149. X
  150. X=>    mkdir /usr/local ; mkdir /usr/local/lib ; mkdir /usr/local/bin
  151. X=>    cp ax386 /usr/local/lib/gcc-as
  152. X
  153. X    Now, you need to make minimal necessary changes to your
  154. X    system include files and then build gcc itself.
  155. X    You may have to modify fixmin.xenix depending on your version
  156. X    of the Operating and Development systems.  Sigh.
  157. X
  158. X=>    cd ../gcc-1.40
  159. X=>    patch -p < ../gcc-1.40.pch
  160. X=>    sh fixmin.xenix        # have to be root to do this!
  161. X=>    sh config.gcc xenix386
  162. X
  163. X    Compile gcc for the first time using the Microsoft compiler:
  164. X
  165. X=>    make -f Makefile.msc -f Makefile msc ALLOCA=alloca.o CFLAGS=
  166. X
  167. X    (This build may fail somewhere and core dump near the end when
  168. X     it tries to build gnulib2.  Ignore it, it doesn't matter)
  169. X
  170. X    Save this version of gcc, then make gcc with this saved version.
  171. X
  172. X=>    make stage1
  173. X=>    make CC=stage1/gcc CFLAGS=-Bstage1/    # cannot optimise yet
  174. X
  175. X    Now we can build an optimised version of gcc.
  176. X
  177. X=>    make stage2
  178. X=>    rm -rf stage1    # regain some disc space if you're short of it.
  179. X=>    make CC=stage2/gcc CFLAGS="-Bstage2/ -O"
  180. X
  181. X    At this point, we have a correctly compiled version of gcc.
  182. X    We now install it, then go and recompile gas with gcc
  183. X
  184. X=>    make install INSTALL=cp
  185. X=>    cd ../gas-1.38
  186. X=>    rm -f *.o ax386
  187. X=>    make ax386 G0="-O -DUSG -DWORKING_DOT_WORD" O1= LOADLIBES= CC=gcc
  188. X=>    cp ax386 /usr/local/lib/gcc-as
  189. X=>    rm -f /usr/local/bin/gas
  190. X=>    ln /usr/local/lib/gcc-as /usr/local/bin/gas
  191. X
  192. X    Finally, we compile gcc again, using a correctly built gas.
  193. X
  194. X=>    cd ../gcc-1.40
  195. X=>    make stage3
  196. X=>    rm -rf stage2    # regain some disc space if you're short of it.
  197. X=>    make CC=stage3/gcc CFLAGS="-Bstage3/ -O"
  198. X
  199. X    In fact, if we're lucky, this version should be identical to
  200. X    the previous version, and if it is, we're happy.  So let's check.
  201. X
  202. X=>    for i in *.o ; do cmp -s $i stage3/$i || echo $i broke ; done
  203. X
  204. X    (Hopefully none should break, if any do, you will have to iterate
  205. X     through more stage builds of both gcc and gas until it no longer
  206. X     breaks)
  207. X
  208. X    Now, we install Christopher's ld helper program so that
  209. X    gcc's -l and -L options will work:
  210. X
  211. X=>    gcc -O -Iconfig xenixld.c -o gcc-ld
  212. X=>    cp gcc-ld /usr/local/lib/gcc-ld
  213. X
  214. X    Now, it's probably wise to undo the damage we did to /usr/include
  215. X
  216. X=>    sh fixmin.xenix undo
  217. X
  218. X    However, the include files are really not in a useable state.
  219. X    You will have to hack them a lot, but the fix.h.xenix file contains
  220. X    a few useful hints.  But *PLEASE* read it before you execute it,
  221. X    as it may well need customising for your site.  In particular,
  222. X    if you've done stuff like adding #ifdef _SIZE_T to your include files,
  223. X    the script may not work anymore.  But the __M_I386__ hack in there
  224. X    must be done, or else you won't be able to use gcc -ansi.
  225. X
  226. X=>    sh fix.h.xenix
  227. X
  228. X    I guess a debugger is useful to have so let's build that:
  229. X
  230. X=>    cd ../dist-gdb
  231. X=>    patch -p < ../gdb-3.5b.pch
  232. X=>    sh config.gdb xenix386
  233. X
  234. X    Depending on the version of your Development System libraries,
  235. X    you may have to edit m-xenix386.h at this point to #define
  236. X    the symbol PTRACE_ADDR_ARG_STRUCT.  This is necessary for version 2.2,
  237. X    but not for 2.3 (the default).
  238. X
  239. X=>    make CC=gcc GLOBAL_CFLAGS="-O -I. -traditional -DNO_PROTOTYPE"
  240. X=>    mv gdb /usr/local/bin
  241. X
  242. X    There's a helper module that's useful for use with GDB.
  243. X    Read the source file gdbspace.asm for more info.
  244. X    (/usr/lib/storel is part of your XENIX link kit).
  245. X=>    /usr/lib/storel gdbspace.asm && mv gdbspace.o /usr/local/lib/libgdb.a
  246. X
  247. X    Then it's probably time for a long beer.  Of course, Murphy's
  248. X    Law states that your disc controller will probably die,
  249. X    destroying your disc in the process just at this point ....
  250. X
  251. XIf you come across any XENIX-related GCC problems, please send mail to
  252. XSteve Bleazard <steve@robobar.co.uk>  or  uunet!mcsun!ukc!robobar!steve
  253. END_OF_FILE
  254.   if test 8239 -ne `wc -c <'README.GCC'`; then
  255.     echo shar: \"'README.GCC'\" unpacked with wrong size!
  256.   fi
  257.   # end of 'README.GCC'
  258. fi
  259. if test -f 'gcc-1.40.pch' -a "${1}" != "-c" ; then 
  260.   echo shar: Will not clobber existing file \"'gcc-1.40.pch'\"
  261. else
  262.   echo shar: Extracting \"'gcc-1.40.pch'\" \(41132 characters\)
  263.   sed "s/^X//" >'gcc-1.40.pch' <<'END_OF_FILE'
  264. X*** gcc-1.40/Makefile    Mon Jul 29 13:15:49 1991
  265. X--- Makefile    Mon Jul 29 13:45:38 1991
  266. X***************
  267. X*** 157,162 ****
  268. X--- 157,167 ----
  269. X  # HARD_PARAMS_FLAGS= -Anansi
  270. X  # (Says vasta@apollo.com.)
  271. X  
  272. X+ # To compile GCC with Microsoft CC use the following CFLAGS and then
  273. X+ # 'make msc'.  Note that the resultant cc1 CANNOT compile with optimization
  274. X+ # switched on, ie stage 2 should not have '-O' in CFLAGS
  275. X+ CFLAGS = -g $(XCFLAGS)
  276. X+ PRAGMA=pragmapack.o
  277. X  
  278. X  # Dependency on obstack, alloca, malloc or whatever library facilities
  279. X  # are not installed in the system libraries.
  280. X***************
  281. X*** 192,198 ****
  282. X   symout.o dbxout.o sdbout.o emit-rtl.o insn-emit.o \
  283. X   integrate.o jump.o cse.o loop.o flow.o stupid.o combine.o \
  284. X   regclass.o local-alloc.o global-alloc.o reload.o reload1.o caller-save.o \
  285. X!  insn-peep.o final.o recog.o insn-recog.o insn-extract.o insn-output.o
  286. X  
  287. X  # Files to be copied away after each stage in building.
  288. X  STAGE_GCC=gcc
  289. X--- 197,203 ----
  290. X   symout.o dbxout.o sdbout.o emit-rtl.o insn-emit.o \
  291. X   integrate.o jump.o cse.o loop.o flow.o stupid.o combine.o \
  292. X   regclass.o local-alloc.o global-alloc.o reload.o reload1.o caller-save.o \
  293. X!  insn-peep.o final.o recog.o insn-recog.o insn-extract.o insn-output.o $(PRAGMA)
  294. X  
  295. X  # Files to be copied away after each stage in building.
  296. X  STAGE_GCC=gcc
  297. X***************
  298. X*** 239,244 ****
  299. X--- 244,257 ----
  300. X  # is include the system varargs.h.
  301. X  
  302. X  all: config.status gnulib gcc cc1 cpp float.h gnulib2 # cc1plus
  303. X+ msc: config.status gnulib cc1 cpp float.h gcc.msc gnulib2 # cc1plus
  304. X+ 
  305. X+ gcc.msc:    cc1 cpp version.o $(LIBDEPS)
  306. X+     ./cpp -I/usr/include $(CPPFLAGS) $(INCLUDES) gcc.c > tmpgcc.i
  307. X+     -./cc1 -quiet $(CFLAGS) -o tmpgcc.s tmpgcc.i
  308. X+     /usr/local/lib/gcc-as -o gcc.o tmpgcc.s
  309. X+     rm -f tmpgcc.s
  310. X+     $(CC) $(CFLAGS) $(LDFLAGS) -o gcc gcc.o version.o $(LIBS)
  311. X  
  312. X  # Use this instead of `all' if you need to convert the libraries
  313. X  # before you can use the compiler.
  314. X***************
  315. X*** 433,440 ****
  316. X  # from the GNU Emacs distribution.
  317. X  # Note some machines won't allow $(CC) without -S on this source file.
  318. X  alloca.o:    alloca.c
  319. X!     $(CC) $(CFLAGS) -S `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
  320. X!     as alloca.s -o alloca.o
  321. X  
  322. X  # Now the source files that are generated from the machine description.
  323. X  
  324. X--- 446,452 ----
  325. X  # from the GNU Emacs distribution.
  326. X  # Note some machines won't allow $(CC) without -S on this source file.
  327. X  alloca.o:    alloca.c
  328. X!     $(CC) $(CFLAGS) -c `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
  329. X  
  330. X  # Now the source files that are generated from the machine description.
  331. X  
  332. X*** gcc-1.40/Makefile.msc
  333. X--- Makefile.msc    Wed Jul 10 16:36:39 1991
  334. X***************
  335. X*** 0 ****
  336. X--- 1,22 ----
  337. X+ # Microsoft C 5.1's built in cpp does not grok the large macros.
  338. X+ # Therefore use the AT&T cpp instead for the files that fail.
  339. X+ # Use this command line:
  340. X+ #    make -f Makefile -f Makefile.msc msc ALLOCA=alloca.o
  341. X+ 
  342. X+ explow.o:    explow.c
  343. X+     /lib/cpp -P ${INCLUDES} explow.c >explow.i
  344. X+     mv explow.i x.c
  345. X+     cc ${CFLAGS} -c x.c
  346. X+     mv x.o explow.o
  347. X+ 
  348. X+ reload.o:    reload.c
  349. X+     /lib/cpp -P ${INCLUDES} reload.c >reload.i
  350. X+     mv reload.i x.c
  351. X+     cc ${CFLAGS} -c x.c
  352. X+     mv x.o reload.o
  353. X+ 
  354. X+ recog.o:    recog.c
  355. X+     /lib/cpp -P ${INCLUDES} recog.c >recog.i
  356. X+     mv recog.i x.c
  357. X+     cc ${CFLAGS} -c x.c
  358. X+     mv x.o recog.o
  359. X*** gcc-1.40/c-parse.y    Mon Jul 29 13:15:54 1991
  360. X--- c-parse.y    Wed Jul 10 15:56:21 1991
  361. X***************
  362. X*** 1803,1808 ****
  363. X--- 1803,1849 ----
  364. X            && getc (finput) == 'm'
  365. X            && getc (finput) == 'a'
  366. X            && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
  367. X+ #ifdef PRAGMA_PACK
  368. X+       {
  369. X+         token = yylex();
  370. X+             if (token != IDENTIFIER) 
  371. X+             goto skipline;
  372. X+ 
  373. X+             if (strcmp(token_buffer, "pack") != 0)
  374. X+                 goto skipline;
  375. X+         
  376. X+         token = yylex();
  377. X+           if (token != '(') {
  378. X+             error ("invalid #pragma pack expecting '('");
  379. X+             goto skipline;
  380. X+         }
  381. X+ 
  382. X+         /* setup default alignment first */
  383. X+ 
  384. X+         pragma_pack_default();
  385. X+ 
  386. X+         token = yylex();
  387. X+         if (token != ')')
  388. X+         {
  389. X+             if (token == CONSTANT
  390. X+                 && TREE_CODE (yylval.ttype) == INTEGER_CST) {
  391. X+                 int l = TREE_INT_CST_LOW (yylval.ttype);
  392. X+                 pragma_pack(l);
  393. X+             }
  394. X+             else {
  395. X+                 error ("invalid #pragma pack expecting 1, 2 or 4");
  396. X+                 goto skipline;
  397. X+             }
  398. X+ 
  399. X+             token = yylex();
  400. X+         }
  401. X+ 
  402. X+           if (token != ')') {
  403. X+             error ("invalid #pragma pack expecting ')'");
  404. X+             goto skipline;
  405. X+         }
  406. X+         }
  407. X+ #endif
  408. X          goto skipline;
  409. X      }
  410. X  
  411. X*** gcc-1.40/config/tm-xenix386.h
  412. X--- config/tm-xenix386.h    Thu Aug 22 15:28:27 1991
  413. X***************
  414. X*** 0 ****
  415. X--- 1,146 ----
  416. X+ /* Definitions for Intel 386 running SCO XENIX 386.
  417. X+    Copyright (C) 1988 Free Software Foundation, Inc.
  418. X+ 
  419. X+ This file is part of GNU CC.
  420. X+ 
  421. X+ GNU CC is free software; you can redistribute it and/or modify
  422. X+ it under the terms of the GNU General Public License as published by
  423. X+ the Free Software Foundation; either version 1, or (at your option)
  424. X+ any later version.
  425. X+ 
  426. X+ GNU CC is distributed in the hope that it will be useful,
  427. X+ but WITHOUT ANY WARRANTY; without even the implied warranty of
  428. X+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  429. X+ GNU General Public License for more details.
  430. X+ 
  431. X+ You should have received a copy of the GNU General Public License
  432. X+ along with GNU CC; see the file COPYING.  If not, write to
  433. X+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  434. X+ 
  435. X+ 
  436. X+ #include "tm-i386.h"
  437. X+ 
  438. X+ /* Use the XENIX GAS assembler syntax.  */
  439. X+ 
  440. X+ #include "tm-xgas386.h"
  441. X+ 
  442. X+ /* By default, target has a 80387 -- XENIX emulates it anyway  */
  443. X+ 
  444. X+ #define TARGET_DEFAULT 1
  445. X+ 
  446. X+ /* Use crt1.o as a startup file and crtn.o as a closing file.  */
  447. X+ 
  448. X+ #define STARTFILE_SPEC  "Sseg.o%s %{!p:Scrt0.o%s} %{p:Smcrt0.o%s}"
  449. X+ #define STANDARD_STARTFILE_PREFIX_1 "/lib/386/"
  450. X+ 
  451. X+ /* -v is appropriate for use with GAS */
  452. X+ 
  453. X+ #define ASM_SPEC    "%{v} %{g}"
  454. X+ 
  455. X+ #define LIB_SPEC "Slibcfp.a%s Slibc.a%s"
  456. X+ 
  457. X+ #define FULL_LINK_SPEC "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l %{g:-g} \
  458. X+  %{A} %{r} %{s} %{u*} \
  459. X+  %{!nostdlib:%S} %{L*} %{!o:-o a.out} %o %{!nostdlib:gnulib%s %L gnulib%s}\n \
  460. X+   }}}}";
  461. X+ #define LINK_SPEC "-i"
  462. X+ 
  463. X+ /* This is for use with G++.  FASCIST_LDR is defined in G++'s Makefile */
  464. X+ 
  465. X+ #ifdef FASCIST_LDR
  466. X+ 
  467. X+ #define FULL_COLLECT_SPEC \
  468. X+   "%{!c:%{!M*:%{!E:%{!S:collect -o %g.S %g.R\n\
  469. X+ as %g.S -o %g.O\n\
  470. X+ ld %{o*} %{!o:-o a.out} %{!nostdlib:%S } %l %{g:-g} \
  471. X+ %{L*} %o %g.O %{!nostdlib:gnulib++%s gnulib%s %L } \n\
  472. X+ }}}}"
  473. X+ 
  474. X+ #define PLUS_FULL_LINK_SPEC \
  475. X+   "%{!c:%{!M*:%{!E:%{!S:ld -o %g.R \
  476. X+   %{!nostdlib:%S } %l %{g:-g}\
  477. X+   %{L*} %o %{!nostdlib:gnulib++%s gnulib%s g++dummy%s %L }\n }}}}";
  478. X+ 
  479. X+ #else /* not FASCIST_LDR */
  480. X+ 
  481. X+ #define FULL_COLLECT_SPEC \
  482. X+   "%{!c:%{!M*:%{!E:%{!S:collect -o %g.S %g.R\n\
  483. X+ as %g.S -o %g.O\n\
  484. X+ ld %{o*} %{!o:-o a.out} %{!nostdlib:%S } %g.R %g.O \
  485. X+   %{!nostdlib:gnulib++%s gnulib%s %L } \n\
  486. X+ }}}}"
  487. X+ 
  488. X+ #define PLUS_FULL_LINK_SPEC \
  489. X+   "%{!c:%{!M*:%{!E:%{!S:ld -r -o %g.R %l %{g:-g}\
  490. X+   %{L*} %o %{!nostdlib:%L }\n }}}}";
  491. X+ 
  492. X+ #endif /* not FASCIST_LDR */
  493. X+ 
  494. X+ /* Specify predefined symbols in preprocessor.  */
  495. X+ /* You may wish to add -DM_INTERNAT, depending on your libraries. */
  496. X+ 
  497. X+ #define CPP_PREDEFINES "-Dunix \
  498. X+ -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT -DM_I386 -DM_XENIX -DM_BITFIELDS \
  499. X+ -Di386 -DM_XOUT -DM_SYS5 -DM_SYSV -DM_SYS3 -DM_SYSIII \
  500. X+ -DM_WORDSWAP"
  501. X+ 
  502. X+ /* no #sccs in preprocessor.  */
  503. X+ 
  504. X+ #undef SCCS_DIRECTIVE
  505. X+ 
  506. X+ /* no #ident */
  507. X+ 
  508. X+ /* #define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME); */
  509. X+ 
  510. X+ /* We dont want to output SDB debugging information.  */
  511. X+ 
  512. X+ #undef SDB_DEBUGGING_INFO
  513. X+ 
  514. X+ /* We want to output DBX debugging information, for use with GDB only  */
  515. X+ 
  516. X+ #define DBX_DEBUGGING_INFO
  517. X+ 
  518. X+ /* Implicit library calls should use memcpy, not bcopy, etc.  */
  519. X+ 
  520. X+ #define TARGET_MEM_FUNCTIONS
  521. X+ 
  522. X+ /* Writing `int' for a bitfield forces int alignment for the structure.  */
  523. X+ 
  524. X+ #undef PCC_BITFIELD_TYPE_MATTERS
  525. X+ 
  526. X+ /* Generate an external symbol request for __fltused if 80387 selected */
  527. X+ 
  528. X+ #undef ASM_FILE_START
  529. X+ #define ASM_FILE_START(FILE)                    \
  530. X+   { fprintf (FILE, "\t.file\t\"%s\"\n", dump_base_name);     \
  531. X+     if (TARGET_80387)                         \
  532. X+       fprintf (FILE, "\t.stabs\t\"__fltused\",0,0,0,0\n"); }
  533. X+ 
  534. X+ 
  535. X+ /* Machines that use the AT&T assembler syntax
  536. X+    also return floating point values in an FP register.  */
  537. X+ /* Define how to find the value returned by a function.
  538. X+    VALTYPE is the data type of the value (as a tree).
  539. X+    If the precise function being called is known, FUNC is its FUNCTION_DECL;
  540. X+    otherwise, FUNC is 0.  */
  541. X+ 
  542. X+ #define VALUE_REGNO(MODE) \
  543. X+   (((MODE)==SFmode || (MODE)==DFmode) ? FIRST_FLOAT_REG : 0)
  544. X+ 
  545. X+ /* 1 if N is a possible register number for a function value. */
  546. X+ 
  547. X+ #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N)== FIRST_FLOAT_REG)
  548. X+ 
  549. X+ /* Put address tables in data segment */
  550. X+ 
  551. X+ #undef ASM_OUTPUT_CASE_LABEL
  552. X+ #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE)    \
  553. X+   { data_section();                        \
  554. X+     ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM); }
  555. X+ 
  556. X+ #undef ASM_OUTPUT_CASE_END
  557. X+ #define ASM_OUTPUT_CASE_END(FILE,NUM,INSN) text_section()
  558. X+ 
  559. X+ #undef FUNCTION_PROFILER
  560. X+ #define FUNCTION_PROFILER(FILE, LABELNO)  \
  561. X+    fprintf (FILE, "\tmovl $%sP%d,%%edx\n\tcall __mcount\n", LPREFIX, (LABELNO));
  562. X*** gcc-1.40/config/tm-xgas386.h
  563. X--- config/tm-xgas386.h    Wed Jul 10 15:56:17 1991
  564. X***************
  565. X*** 0 ****
  566. X--- 1,253 ----
  567. X+ /* Definitions for AT&T assembler syntax for the Intel 80386.
  568. X+    Copyright (C) 1988 Free Software Foundation, Inc.
  569. X+ 
  570. X+ This file is part of GNU CC.
  571. X+ 
  572. X+ GNU CC is free software; you can redistribute it and/or modify
  573. X+ it under the terms of the GNU General Public License as published by
  574. X+ the Free Software Foundation; either version 1, or (at your option)
  575. X+ any later version.
  576. X+ 
  577. X+ GNU CC is distributed in the hope that it will be useful,
  578. X+ but WITHOUT ANY WARRANTY; without even the implied warranty of
  579. X+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  580. X+ GNU General Public License for more details.
  581. X+ 
  582. X+ You should have received a copy of the GNU General Public License
  583. X+ along with GNU CC; see the file COPYING.  If not, write to
  584. X+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  585. X+ 
  586. X+ 
  587. X+ #ifdef PRAGMA_PACK
  588. X+ #define TARGET_VERSION fprintf (stderr, " (80386, Xenix GAS syntax, #pragma pack() support included)");
  589. X+ #else
  590. X+ #define TARGET_VERSION fprintf (stderr, " (80386, Xenix GAS syntax)");
  591. X+ #endif
  592. X+ 
  593. X+ /* Define the syntax of instructions and addresses.  */
  594. X+ 
  595. X+ /* Define some concatenation macros to concatenate an opcode
  596. X+    and one, two or three operands.  In other assembler syntaxes
  597. X+    they may alter the order of ther operands.  */
  598. X+ 
  599. X+ #ifdef __STDC__
  600. X+ #define AS2(a,b,c) #a " " #b "," #c
  601. X+ #define AS3(a,b,c,d) #a " " #b "," #c "," #d
  602. X+ #define AS1(a,b) #a " " #b
  603. X+ #else
  604. X+ #define AS1(a,b) "a b"
  605. X+ #define AS2(a,b,c) "a b,c"
  606. X+ #define AS3(a,b,c,d) "a b,c,d"
  607. X+ #endif  
  608. X+ 
  609. X+ /* Output the size-letter for an opcode.
  610. X+    CODE is the letter used in an operand spec (L, B, W, S or Q).
  611. X+    CH is the corresponding lower case letter
  612. X+      (except if CODE is L then CH is `l').  */
  613. X+ #define PUT_OP_SIZE(CODE,CH,FILE) putc (CH,(FILE))
  614. X+ 
  615. X+ /* Opcode suffix for fullword insn.  */
  616. X+ #define L_SIZE "l"
  617. X+ 
  618. X+ /* Prefix for register names in this syntax.  */
  619. X+ #define RP "%"
  620. X+ 
  621. X+ /* Prefix for immediate operands in this syntax.  */
  622. X+ #define IP "$"
  623. X+ 
  624. X+ /* Prefix for internally generated assembler labels.  */
  625. X+ #define LPREFIX ".L"
  626. X+ 
  627. X+ /* Output the prefix for an immediate operand, or for an offset operand.  */
  628. X+ #define PRINT_IMMED_PREFIX(FILE)  fputs ("$", (FILE))
  629. X+ #define PRINT_OFFSET_PREFIX(FILE)  fputs ("$", (FILE))
  630. X+ 
  631. X+ /* Indirect call instructions should use `*'.  */
  632. X+ #define USE_STAR 1
  633. X+ 
  634. X+ /* Prefix for a memory-operand X.  */
  635. X+ #define PRINT_PTR(X, FILE)
  636. X+ 
  637. X+ /* Delimiters that surround base reg and index reg.  */
  638. X+ #define ADDR_BEG(FILE) putc('(', (FILE))
  639. X+ #define ADDR_END(FILE) putc(')', (FILE))
  640. X+ 
  641. X+ /* Print an index register (whose rtx is IREG).  */
  642. X+ #define PRINT_IREG(FILE,IREG) \
  643. X+   do                                \
  644. X+   { fputs (",", (FILE)); PRINT_REG ((IREG), 0, (FILE)); }    \
  645. X+   while (0)
  646. X+   
  647. X+ /* Print an index scale factor SCALE.  */
  648. X+ #define PRINT_SCALE(FILE,SCALE) \
  649. X+   if ((SCALE) != 1) fprintf ((FILE), ",%d", (SCALE))
  650. X+ 
  651. X+ /* Print a base/index combination.
  652. X+    BREG is the base reg rtx, IREG is the index reg rtx,
  653. X+    and SCALE is the index scale factor (an integer).  */
  654. X+ 
  655. X+ #define PRINT_B_I_S(BREG,IREG,SCALE,FILE) \
  656. X+   { ADDR_BEG (FILE);                 \
  657. X+     if (BREG) PRINT_REG ((BREG), 0, (FILE));    \
  658. X+     if ((IREG) != 0)                \
  659. X+       { PRINT_IREG ((FILE), (IREG));        \
  660. X+         PRINT_SCALE ((FILE), (SCALE)); }    \
  661. X+     ADDR_END (FILE); }
  662. X+ 
  663. X+ /* Define the syntax of pseudo-ops, labels and comments.  */
  664. X+ 
  665. X+ /* Assembler pseudos to introduce constants of various size.  */
  666. X+ 
  667. X+ #define ASM_BYTE "\t.byte "
  668. X+ #define ASM_SHORT "\t.value "
  669. X+ #define ASM_LONG "\t.long "
  670. X+ #define ASM_DOUBLE "\t.double "
  671. X+ 
  672. X+ /* String containing the assembler's comment-starter.  */
  673. X+ 
  674. X+ #define COMMENT_BEGIN "/"
  675. X+ 
  676. X+ /* Output at beginning of assembler file.  */
  677. X+ /* The .file command should always begin the output.  */
  678. X+ 
  679. X+ #undef ASM_FILE_START
  680. X+ #define ASM_FILE_START(FILE) \
  681. X+   fprintf (FILE, "\t.file\t\"%s\"\n", dump_base_name);
  682. X+ 
  683. X+ /* Don't write a `.optim' pseudo; this assembler doesn't handle them.  */
  684. X+ 
  685. X+ #undef ASM_FILE_START_1
  686. X+ #define ASM_FILE_START_1(FILE)
  687. X+ 
  688. X+ /* Output to assembler file text saying following lines
  689. X+    may contain character constants, extra white space, comments, etc.  */
  690. X+ 
  691. X+ #define ASM_APP_ON "/APP\n"
  692. X+ 
  693. X+ /* Output to assembler file text saying following lines
  694. X+    no longer contain unusual constructs.  */
  695. X+ 
  696. X+ #define ASM_APP_OFF "/NO_APP\n"
  697. X+ 
  698. X+ /* This is how to output an assembler line
  699. X+    that says to advance the location counter by SIZE bytes.  */
  700. X+ 
  701. X+ #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
  702. X+   fprintf ((FILE), "\t.set .,.+%d\n", (SIZE))
  703. X+ 
  704. X+ /* Output before read-only data.  */
  705. X+ 
  706. X+ #define TEXT_SECTION_ASM_OP ".text"
  707. X+ 
  708. X+ /* Output before writable data.  */
  709. X+ 
  710. X+ #define DATA_SECTION_ASM_OP ".data"
  711. X+ 
  712. X+ /* Define the syntax of labels and symbol definitions/declarations.  */
  713. X+ 
  714. X+ /* This says how to output an assembler line
  715. X+    to define a global common symbol.  */
  716. X+ /* We don't use ROUNDED because the standard compiler doesn't,
  717. X+    and the linker gives error messages if a common symbol
  718. X+    has more than one length value.  */
  719. X+ 
  720. X+ #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
  721. X+ ( fputs (".comm ", (FILE)),            \
  722. X+   assemble_name ((FILE), (NAME)),        \
  723. X+   fprintf ((FILE), ",%d\n", (SIZE)))
  724. X+ 
  725. X+ /* This says how to output an assembler line
  726. X+    to define a local common symbol.  */
  727. X+ 
  728. X+ /* Try lcomm to generate local bss 
  729. X+  *
  730. X+  * #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
  731. X+  *   (data_section (),                \
  732. X+  *    ASM_OUTPUT_LABEL ((FILE), (NAME)),        \
  733. X+  *    fprintf ((FILE), "\t.set .,.+%d\n", (ROUNDED)))
  734. X+  */
  735. X+ #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
  736. X+ ( fputs (".lcomm ", (FILE)),            \
  737. X+   assemble_name ((FILE), (NAME)),        \
  738. X+   fprintf ((FILE), ",%d\n", (SIZE)))
  739. X+ 
  740. X+ 
  741. X+ /* This is how to output an assembler line
  742. X+    that says to advance the location counter
  743. X+    by a multiple of 2**LOG bytes.  */
  744. X+ 
  745. X+ #define ASM_OUTPUT_ALIGN(FILE,LOG)    \
  746. X+      if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", (LOG))
  747. X+ 
  748. X+ /* This is how to store into the string BUF
  749. X+    the symbol_ref name of an internal numbered label where
  750. X+    PREFIX is the class of label and NUM is the number within the class.
  751. X+    This is suitable for output with `assemble_name'.  */
  752. X+ 
  753. X+ #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)    \
  754. X+   sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER))
  755. X+ 
  756. X+ /* This is how to output an internal numbered label where
  757. X+    PREFIX is the class of label and NUM is the number within the class.  */
  758. X+ 
  759. X+ #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)    \
  760. X+   fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
  761. X+ 
  762. X+ /* This is how to output a reference to a user-level label named NAME.  */
  763. X+ 
  764. X+ #define ASM_OUTPUT_LABELREF(FILE,NAME)    \
  765. X+   fprintf (FILE, "_%s", NAME)
  766. X+ 
  767. X+ /* This is how to output a command to make the user-level label named NAME
  768. X+    defined for reference from other files.  */
  769. X+ 
  770. X+ #define ASM_GLOBALIZE_LABEL(FILE,NAME)    \
  771. X+   (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
  772. X+ 
  773. X+ /* How to output an ASCII string constant.  */
  774. X+ 
  775. X+ #define ASM_OUTPUT_ASCII(FILE, p, size) \
  776. X+ { int i=0;                         \
  777. X+   while (i < size)                    \
  778. X+     { if (i%10 == 0) { if (i!=0) fprintf (FILE, "\n");    \
  779. X+                fprintf (FILE, ASM_BYTE); }    \
  780. X+       else fprintf (FILE, ",");                \
  781. X+     fprintf (FILE, "0x%x",(p[i++] & 0377)) ;}    \
  782. X+       fprintf (FILE, "\n"); }
  783. X+ 
  784. X+ #define EXTRA_SECTIONS in_cdata
  785. X+ 
  786. X+ /* Define the additional functions to select our additional sections.  */
  787. X+ 
  788. X+ #define CDATA_SECTION_ASM_OP ".data 1"
  789. X+ 
  790. X+ #define EXTRA_SECTION_FUNCTIONS                        \
  791. X+ void                                    \
  792. X+ cdata_section ()                            \
  793. X+ {                                    \
  794. X+   if (in_section != in_cdata)                        \
  795. X+     {                                    \
  796. X+       fprintf (asm_out_file, "%s\n", CDATA_SECTION_ASM_OP);        \
  797. X+       in_section = in_cdata;                        \
  798. X+     }                                \
  799. X+ }
  800. X+ 
  801. X+ /* Given a decl node or constant node, choose the section to output it in
  802. X+    and select that section.  */
  803. X+ 
  804. X+        /* following takes  care of constants  emitted from
  805. X+       the hash table entries (see above comment)
  806. X+        */
  807. X+ #define SELECT_SECTION_MODE(MODE,RTX) cdata_section();
  808. X+ #define SELECT_RTX_SECTION(MODE, RTX) cdata_section();
  809. X+ #define SELECT_SECTION(DECL)                        \
  810. X+   { if (TREE_CODE (DECL) == STRING_CST) {                \
  811. X+        if (flag_writable_strings)                    \
  812. X+           data_section ();                        \
  813. X+        else                                \
  814. X+         cdata_section ();                        \
  815. X+     }                                    \
  816. X+     else if (TREE_READONLY (DECL) && ! TREE_VOLATILE (DECL))        \
  817. X+       cdata_section ();                            \
  818. X+     else                                \
  819. X+       data_section (); }
  820. X*** gcc-1.40/config/xm-xenix386.h
  821. X--- config/xm-xenix386.h    Fri Jul 12 07:43:58 1991
  822. X***************
  823. X*** 0 ****
  824. X--- 1,55 ----
  825. X+ /* Configuration for GNU C-compiler for Intel 80386 running SCO Xenix 386
  826. X+    Copyright (C) 1988 Free Software Foundation, Inc.
  827. X+ 
  828. X+ This file is part of GNU CC.
  829. X+ 
  830. X+ GNU CC is free software; you can redistribute it and/or modify
  831. X+ it under the terms of the GNU General Public License as published by
  832. X+ the Free Software Foundation; either version 1, or (at your option)
  833. X+ any later version.
  834. X+ 
  835. X+ GNU CC is distributed in the hope that it will be useful,
  836. X+ but WITHOUT ANY WARRANTY; without even the implied warranty of
  837. X+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  838. X+ GNU General Public License for more details.
  839. X+ 
  840. X+ You should have received a copy of the GNU General Public License
  841. X+ along with GNU CC; see the file COPYING.  If not, write to
  842. X+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  843. X+ 
  844. X+ 
  845. X+ /* #defines that need visibility everywhere.  */
  846. X+ #define FALSE 0
  847. X+ #define TRUE 1
  848. X+ 
  849. X+ /* This describes the machine the compiler is hosted on.  */
  850. X+ #define HOST_BITS_PER_CHAR 8
  851. X+ #define HOST_BITS_PER_SHORT 16
  852. X+ #define HOST_BITS_PER_INT 32
  853. X+ #define HOST_BITS_PER_LONG 32
  854. X+ 
  855. X+ /* Arguments to use with `exit'.  */
  856. X+ #define SUCCESS_EXIT_CODE 0
  857. X+ #define FATAL_EXIT_CODE 33
  858. X+ 
  859. X+ #define USG
  860. X+ 
  861. X+ #ifndef __GNUC__
  862. X+ #define register auto /* Register variables are broken */
  863. X+ #endif
  864. X+ 
  865. X+ /* target machine dependencies.
  866. X+    tm.h is a symbolic link to the actual target specific file.   */
  867. X+ #include "tm.h"
  868. X+ 
  869. X+ #define bcopy(a,b,c) memcpy (b,a,c)
  870. X+ #define bzero(a,b) memset (a,0,b)
  871. X+ #define bcmp(a,b,c) memcmp (a,b,c)
  872. X+ 
  873. X+ #ifdef __GNUC__
  874. X+ #define alloca(n) __builtin_alloca(n)
  875. X+ #endif
  876. X+ 
  877. X+ /* Implement Microsoft C compatible #pragma pack() */
  878. X+ 
  879. X+ #define PRAGMA_PACK
  880. X*** gcc-1.40/config.gcc    Mon Jul 29 13:16:42 1991
  881. X--- config.gcc    Wed Jul 10 15:56:16 1991
  882. X***************
  883. X*** 331,336 ****
  884. X--- 331,340 ----
  885. X  #    370)
  886. X  #        machine=370
  887. X  #        ;;
  888. X+     xenix386)        # for SCO Xenix/386
  889. X+         cpu_type=i386
  890. X+         configuration_file=xm-${machine}.h
  891. X+         ;;
  892. X      esac
  893. X  
  894. X          # if cpu_type is not set, define cpu_type to machine.
  895. X*** gcc-1.40/gcc.c    Mon Jul 29 13:16:57 1991
  896. X--- gcc.c    Fri Jul 12 08:15:31 1991
  897. X***************
  898. X*** 303,312 ****
  899. X--- 303,316 ----
  900. X  };
  901. X  
  902. X  /* Here is the spec for running the linker, after compiling all files.  */
  903. X+ #ifdef FULL_LINK_SPEC
  904. X+ char *link_spec = FULL_LINK_SPEC
  905. X+ #else
  906. X  char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l\
  907. X   %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
  908. X   %{y*} %{!A:%{!nostdlib:%S}} \
  909. X   %{L*} %o %{!nostdlib:%G gnulib%s %L gnulib%s %{!A:%E}}\n }}}}";
  910. X+ #endif
  911. X  
  912. X  /* Accumulate a command (program name and args), and run it.  */
  913. X  
  914. X***************
  915. X*** 361,368 ****
  916. X  #define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
  917. X  #endif /* !defined STANDARD_STARTFILE_PREFIX */
  918. X  
  919. X  char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
  920. X! char *standard_startfile_prefix_1 = "/lib/";
  921. X  char *standard_startfile_prefix_2 = "/usr/lib/";
  922. X  
  923. X  /* Clear out the vector of arguments (after a command is executed).  */
  924. X--- 365,376 ----
  925. X  #define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
  926. X  #endif /* !defined STANDARD_STARTFILE_PREFIX */
  927. X  
  928. X+ #ifndef STANDARD_STARTFILE_PREFIX_1
  929. X+ #define STANDARD_STARTFILE_PREFIX_1 "/lib/"
  930. X+ #endif /* !defined STANDARD_STARTFILE_PREFIX_1 */
  931. X+ 
  932. X  char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
  933. X! char *standard_startfile_prefix_1 = STANDARD_STARTFILE_PREFIX_1;
  934. X  char *standard_startfile_prefix_2 = "/usr/lib/";
  935. X  
  936. X  /* Clear out the vector of arguments (after a command is executed).  */
  937. X***************
  938. X*** 1383,1389 ****
  939. X  
  940. X  char *
  941. X  handle_braces (p)
  942. X!      register char *p;
  943. X  {
  944. X    register char *q;
  945. X    char *filter;
  946. X--- 1391,1397 ----
  947. X  
  948. X  char *
  949. X  handle_braces (p)
  950. X!      char *p;
  951. X  {
  952. X    register char *q;
  953. X    char *filter;
  954. X*** gcc-1.40/pragmapack.c
  955. X--- pragmapack.c    Wed Jul 10 16:57:32 1991
  956. X***************
  957. X*** 0 ****
  958. X--- 1,26 ----
  959. X+ #define DEFAULT_ALIGN    32
  960. X+ 
  961. X+ static int pack_align = DEFAULT_ALIGN;
  962. X+ static int was_pragma = 0;
  963. X+ 
  964. X+ pragma_pack(val)
  965. X+ int val;
  966. X+ {
  967. X+     pack_align = 8 * val;
  968. X+     was_pragma = 1;
  969. X+ }
  970. X+ 
  971. X+ pragma_align_val()
  972. X+ {
  973. X+     return pack_align;
  974. X+ }
  975. X+ 
  976. X+ pragma_pack_default()
  977. X+ {
  978. X+     pack_align = DEFAULT_ALIGN;
  979. X+ }
  980. X+ 
  981. X+ int pragma_pack_seen()
  982. X+ {
  983. X+     return was_pragma;
  984. X+ }
  985. X*** gcc-1.40/stor-layout.c    Mon Jul 29 13:17:35 1991
  986. X--- stor-layout.c    Wed Jul 10 15:56:23 1991
  987. X***************
  988. X*** 514,519 ****
  989. X--- 514,523 ----
  990. X       or some divisor of it.  */
  991. X  
  992. X        layout_decl (field, var_size ? size_unit : const_size);
  993. X+ #ifdef PRAGMA_PACK
  994. X+       if (pragma_pack_seen())
  995. X+         DECL_ALIGN(field) = MIN(pragma_align_val(), DECL_ALIGN(field));
  996. X+ #endif
  997. X        desired_align = DECL_ALIGN (field);
  998. X  
  999. X        /* Record must have at least as much alignment as any field.
  1000. X*** gcc-1.40/c-parse.tab.c    Mon Jul 29 13:21:25 1991
  1001. X--- c-parse.tab.c    Mon Jul 29 13:53:35 1991
  1002. X***************
  1003. X*** 3201,3206 ****
  1004. X--- 3205,3251 ----
  1005. X            && getc (finput) == 'm'
  1006. X            && getc (finput) == 'a'
  1007. X            && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
  1008. X+ #ifdef PRAGMA_PACK
  1009. X+       {
  1010. X+         token = yylex();
  1011. X+             if (token != IDENTIFIER) 
  1012. X+             goto skipline;
  1013. X+ 
  1014. X+             if (strcmp(token_buffer, "pack") != 0)
  1015. X+                 goto skipline;
  1016. X+         
  1017. X+         token = yylex();
  1018. X+           if (token != '(') {
  1019. X+             error ("invalid #pragma pack expecting '('");
  1020. X+             goto skipline;
  1021. X+         }
  1022. X+ 
  1023. X+         /* setup default alignment first */
  1024. X+ 
  1025. X+         pragma_pack_default();
  1026. X+ 
  1027. X+         token = yylex();
  1028. X+         if (token != ')')
  1029. X+         {
  1030. X+             if (token == CONSTANT
  1031. X+                 && TREE_CODE (yylval.ttype) == INTEGER_CST) {
  1032. X+                 int l = TREE_INT_CST_LOW (yylval.ttype);
  1033. X+                 pragma_pack(l);
  1034. X+             }
  1035. X+             else {
  1036. X+                 error ("invalid #pragma pack expecting 1, 2 or 4");
  1037. X+                 goto skipline;
  1038. X+             }
  1039. X+ 
  1040. X+             token = yylex();
  1041. X+         }
  1042. X+ 
  1043. X+           if (token != ')') {
  1044. X+             error ("invalid #pragma pack expecting ')'");
  1045. X+             goto skipline;
  1046. X+         }
  1047. X+         }
  1048. X+ #endif
  1049. X          goto skipline;
  1050. X      }
  1051. X  
  1052. X*** fix.h.xenix
  1053. X--- fix.h.xenix    Thu Aug 22 21:18:21 1991
  1054. X***************
  1055. X*** 0 ****
  1056. X--- 1,198 ----
  1057. X+ # @(#) $Id: fix.h.xenix,v 1.3 1991/08/22 05:39:05 ronald Exp $
  1058. X+ #
  1059. X+ # (C) Copyright 1990, 1991 Ronald Khoo <ronald@ibmpcug.co.uk>
  1060. X+ # Permission granted to use or abuse this program for any purpose,
  1061. X+ # provided that all modified copies are clearly marked as such.
  1062. X+ # No warranty is given for the fitness of this program for any purpose.
  1063. X+ #
  1064. X+ # Please treat this file as a document saying what I did and not really
  1065. X+ # a program.  i.e.  Please read it through before considering running it.
  1066. X+ #
  1067. X+ # This is a quick hack to fix the SCO Xenix 386 include files so that
  1068. X+ # they work with gcc at all.  No attempt has been made to do this
  1069. X+ # in a general way whatsoever, and this script was not made with any
  1070. X+ # reference to the GCC fixincludes script:  I still have no idea what
  1071. X+ # that does.  This works (ish) for me.  Your mileage may vary.
  1072. X+ # My include files were from the 2.3.4 operating system and the 2.3.1b
  1073. X+ # development system.
  1074. X+ #
  1075. X+ # What the script does do:
  1076. X+ #
  1077. X+ # * stream edit files from /usr/include and /usr/include/sys
  1078. X+ #   into /usr/local/lib/gcc-include, skipping those which are
  1079. X+ #   provided by GCC.
  1080. X+ # * make all references to M_I386 refer to __M_I386__ instead.
  1081. X+ #   This enables programs compiled with gcc -ansi not to coredump.
  1082. X+ #   This only works with gcc so don't give these hacked .h files to cc !!
  1083. X+ # * put protection #ifdef tests to all files to allow them to be safely
  1084. X+ #   multiply included.
  1085. X+ # * time_t and size_t seem to be typedefed all over the place.  Protect them.
  1086. X+ # * remove definition and use of va_list in stdio.h -- that's bogus.
  1087. X+ #   (SCO has already fixed this one in 2.3.1)
  1088. X+ # * make types of SIG_IGN, etc consistently void * in sys/signal.h
  1089. X+ #   (to be consistent with <signal.h>)
  1090. X+ # * various other individual hacks I've come across.  Note that these
  1091. X+ #   are entirely ad-hoc.  You can find them in the lines starting with
  1092. X+ #   sed_<name>="
  1093. X+ #
  1094. X+ # In particular, the ad-hocery was intended to make rcs 5.5 compile without
  1095. X+ # hacking, even with all the recommended warning options set.
  1096. X+ # It doesn't quite work -- rcs 5.5's configuration script is slightly broken.
  1097. X+ # I hate gratuitous declarations.
  1098. X+ #
  1099. X+ # Note that this is only a beginning.  I keep finding annoyances which
  1100. X+ # have to be fixed by hand.  Many prototypes are wrong in places like
  1101. X+ # <stdio.h>, <stdlib.h> etc.  An afternoon spent with an editor in one
  1102. X+ # hand and the ANSI standard in the other would probably not go amiss.
  1103. X+ #
  1104. X+ # This script will probably fall flat on its face if you've already
  1105. X+ # modified the system include files to do what it wants to do.
  1106. X+ # Starting from a fresh set may be a reasonable approach.
  1107. X+ #
  1108. X+ # $Log: fix.h.xenix,v $
  1109. X+ # Revision 1.3  1991/08/22  05:39:05  ronald
  1110. X+ # pre-release version for gfm@mencon.oz to try out.
  1111. X+ #
  1112. X+ # Revision 1.2  1991/08/19  10:55:30  ronald
  1113. X+ # Interim release for gcc 1.40, beta testers.
  1114. X+ #
  1115. X+ # Revision 1.1  90/04/25  18:51:21  ronald
  1116. X+ # Initial revision
  1117. X+ # 
  1118. X+ 
  1119. X+ PATH=/etc:/bin:/usr/bin export PATH
  1120. X+ 
  1121. X+ # usage: /usr/local/lib/fix.h.xenix
  1122. X+ 
  1123. X+ lib=${lib-/usr/local/lib}
  1124. X+ include=$lib/gcc-include
  1125. X+ stdinc=${stdinc-/usr/include}
  1126. X+ 
  1127. X+ sed_mi386=" -e '/\\([^_]\\)M_I386/s//\\1__M_I386__/g'"
  1128. X+ sed_timet=" -e '/typedef.*[     ]time_t/ {
  1129. X+ i\\
  1130. X+ #ifndef _TIME_T
  1131. X+ i\\
  1132. X+ #define _TIME_T
  1133. X+ a\\
  1134. X+ #endif /* _TIME_T */
  1135. X+ }'"
  1136. X+ sed_sizet=" -e '/typedef.*[     ]size_t/ {
  1137. X+ i\\
  1138. X+ #ifndef _SIZE_T
  1139. X+ i\\
  1140. X+ #define _SIZE_T
  1141. X+ a\\
  1142. X+ #endif /* _SIZE_T */
  1143. X+ }'"
  1144. X+ # No prizes for guessing what this macro is used for.
  1145. X+ # Also, no prizes for guessing which editor I use.
  1146. X+ # :s/^[     ]*\([^( ]*\)[     ]*\((.*\);[     ]*$/    \/\\\\(\1[     ]*\\\\)([^)][^)]*)\/s\/\/\\\\1 \2\//
  1147. X+ #
  1148. X+ sed_param=" -e '
  1149. X+     /\(\/\*[^/]*\)\/\*/s//\1 *\/ \/*/
  1150. X+     /^\/\*.*\/\*.*pdp11[     ]*\$/s/\$/*\//
  1151. X+ '"
  1152. X+ sed_errno=" -e '
  1153. X+     /\\(perror[     ]*\\)([^)][^)]*)/s//\\1 ( const char * )/
  1154. X+ '"
  1155. X+ sed_stdlib=" -e '
  1156. X+     /\\(getenv[     ]*\\)([^)][^)]*)/s//\\1 (const char *)/
  1157. X+     /\\(atoi[     ]*\\)([^)][^)]*)/s//\\1 (const char *)/
  1158. X+     /.*\\(free[     ]*\\)([^)][^)]*)/s//extern void \\1 ( void * )/
  1159. X+     /.*\\(malloc[     ]*\\)([^)][^)]*)/s//extern void *\\1 (unsigned)/
  1160. X+     /.*\\(realloc[     ]*\\)([^)][^)]*)/s//extern void *\\1 (void *, unsigned)/
  1161. X+     /.*\\(calloc[     ]*\\)([^)][^)]*)/s//extern void *\\1 (unsigned, unsigned)/
  1162. X+ '"
  1163. X+ sed_stdio=" -e '
  1164. X+     /\\(printf[     ]*\\)([^)][^)]*)/s//\\1 ( const char *, ...)/
  1165. X+     /\\(fprintf[     ]*\\)([^)][^)]*)/s//\\1 ( FILE *, const char *, ... )/
  1166. X+     /\\(vfprintf[     ]*\\)([^)][^)]*)/s//\\1 ( FILE *, const char *, char * )/
  1167. X+     /\\(vprintf[     ]*\\)([^)][^)]*)/s//\\1 ( const char *, char * )/
  1168. X+     /\\(sprintf[     ]*\\)([^)][^)]*)/s//\\1 ( char *, const char *, ... )/
  1169. X+     /\\(vsprintf[     ]*\\)([^)][^)]*)/s//\\1 ( char *, const char *, char * )/
  1170. X+     /\\(fopen[     ]*\\)([^)][^)]*)/s//\\1 ( const char *, const char * )/
  1171. X+     /\\(fdopen[     ]*\\)([^)][^)]*)/s//\\1 ( int, const char * )/
  1172. X+     /\\(fputs[     ]*\\)([^)][^)]*)/s//\\1 ( const char *, FILE * )/
  1173. X+     /\\(fread[     ]*\\)([^)][^)]*)/s//\\1 ( void *, size_t, size_t, FILE * )/
  1174. X+     /\\(fwrite[     ]*\\)([^)][^)]*)/s//\\1 ( const void *, size_t, size_t, FILE * )/
  1175. X+     /typedef.*va_list/d
  1176. X+     /va_list/s//char */
  1177. X+ '"
  1178. X+ sed_string=" -e '
  1179. X+      /\\(strlen[     ]*\\)([^)][^)]*)/s//\\1 ( const char * )/
  1180. X+      /\\(strcat[     ]*\\)([^)][^)]*)/s//\\1 ( char *, const char * )/
  1181. X+      /\\(strncat[     ]*\\)([^)][^)]*)/s//\\1 ( char *, const char *, int )/
  1182. X+      /\\(strcpy[     ]*\\)([^)][^)]*)/s//\\1 ( char *, const char * )/
  1183. X+      /\\(strncpy[     ]*\\)([^)][^)]*)/s//\\1 ( char *, const char *, int )/
  1184. X+      /\\(strchr[     ]*\\)([^)][^)]*)/s//\\1 ( const char *, int )/
  1185. X+      /\\(strrchr[     ]*\\)([^)][^)]*)/s//\\1 ( const char *, int )/
  1186. X+      /\\(strcmp[     ]*\\)([^)][^)]*)/s//\\1 ( const char *, const char * )/
  1187. X+      /\\(strncmp[     ]*\\)([^)][^)]*)/s//\\1 ( const char *, const char *, int )/
  1188. X+     /define.*strerror.*;[     ]*\$/s/;[     ]*\$//
  1189. X+ '"
  1190. X+ sed_signal=" -e '/int.*(\\*)/s/int/void/g'"
  1191. X+ sed_error=" -e '/^[     ]*ERROR[     ]\\(.*\\)\$/ {
  1192. X+ s//\\1/
  1193. X+ s/\"//g
  1194. X+ s/[     ][     ]*/ /g
  1195. X+ s/.*/    #error \"&\"/
  1196. X+ }'"
  1197. X+ 
  1198. X+ hackit()
  1199. X+ {
  1200. X+     echo "\r                         \rHacking $1\c"  >&2 
  1201. X+     idemp=
  1202. X+     expr "`sed 1q $1`" : '.*ifn.*_H.*' > /dev/null && idemp=yes
  1203. X+     test "$idemp" || {
  1204. X+         name=_INCLUDED_`echo $1 | tr './[a-z]' '__[A-Z]'`_AUTOFIX
  1205. X+         echo "#ifndef $name" > $include/$1
  1206. X+         echo "#define $name" >> $include/$1
  1207. X+     }
  1208. X+     script="$sed_mi386"
  1209. X+     grep -s size_t $1 > /dev/null &&
  1210. X+         grep -s _SIZE_T $1 > /dev/null || script="$script $sed_sizet"
  1211. X+     grep -s time_t $1 > /dev/null &&
  1212. X+         grep -s _TIME_T $1 > /dev/null || script="$script $sed_timet"
  1213. X+     case $1 in
  1214. X+         errno.h)    script="$script $sed_errno"    ;;
  1215. X+         stdlib.h)    script="$script $sed_stdlib"    ;;
  1216. X+         string.h)    script="$script $sed_string"    ;;
  1217. X+         stdio.h)    script="$script $sed_errno $sed_stdio"    ;;
  1218. X+         sys/param.h)    script="$script $sed_param"    ;;
  1219. X+         sys/signal.h)    script="$script $sed_signal"    ;;
  1220. X+         curses.h|sys/emap.h|sys/param.h|sys/sxt.h)
  1221. X+                 script="$script $sed_error"    ;;
  1222. X+     esac
  1223. X+     eval sed "$script" $1 >> $include/$1
  1224. X+     test "$idemp" || echo "#endif /* $name */" >> $include/$1
  1225. X+ }
  1226. X+ 
  1227. X+ [ -d $include ] || mkdir $include
  1228. X+ [ -d $include/sys ] || mkdir $include/sys
  1229. X+ 
  1230. X+ cd $stdinc || exit 1
  1231. X+ echo "\rHacking files from $stdinc into $include" >&2
  1232. X+ 
  1233. X+ # This bit is useful for hacking the sed scripts above.
  1234. X+ # for i in sys/param.h # stdio.h stdlib.h errno.h curses.h string.h 
  1235. X+ # do hackit $i ; done
  1236. X+ # exit 1
  1237. X+ 
  1238. X+ for i in *.h 
  1239. X+ do
  1240. X+     case $i in
  1241. X+         # Use the GCC supplied versions of these files:
  1242. X+         assert.h|float.h|limits.h|stdarg.h|stddef.h|varargs.h)    ;;
  1243. X+         *) hackit $i ;;
  1244. X+     esac
  1245. X+ done
  1246. X+ 
  1247. X+ echo "\rHacking files from $stdinc/sys into $include/sys" >&2
  1248. X+ for i in sys/*.h ; do hackit $i ; done
  1249. X+ 
  1250. X+ cd $include
  1251. X+ cd sys ; chgrp bin . *.h ; chmod 664 *.h ; chmod 775 . ; chown bin . *.h
  1252. X+ cd .. ; chgrp bin . *.h ; chmod 664 *.h ; chmod 775 . ; chown bin . *.h
  1253. X+ 
  1254. X+ echo '\r..... done.  Have a nice day.  --Ronald' >&2
  1255. X*** fixmin.xenix
  1256. X--- fixmin.xenix    Thu Aug 22 21:09:28 1991
  1257. X***************
  1258. X*** 0 ****
  1259. X--- 1,76 ----
  1260. X+ # $Id: fixmin.xenix,v 1.1 1991/08/22 20:06:32 ronald Exp $
  1261. X+ # Change Log is at the end of the file.
  1262. X+ #
  1263. X+ # This is the bare minimum of header fixing that I could get away with
  1264. X+ # in order to compile GCC.  This applies to Xenix 2.3.3 with 2.3.1
  1265. X+ # Development System.  You're on your own with other versions.
  1266. X+ # These changes should only be in effect while building gcc.
  1267. X+ # You should undo them, and replace the fixes with something better
  1268. X+ # in /usr/local/lib/gcc-include once you've installed gcc.
  1269. X+ 
  1270. X+ # usage: fixmin.xenix [ undo ]
  1271. X+ # If the "undo" parameter is specified, reverses the actions of a
  1272. X+ # previous run of fixmin.
  1273. X+ 
  1274. X+ cd /usr/include
  1275. X+ 
  1276. X+ if test "$1" = undo ; then
  1277. X+     for i in *.bfm ; do
  1278. X+         j=`basename $i .bfm`
  1279. X+         mv $i $j
  1280. X+         echo restored $j >&2
  1281. X+     done
  1282. X+     cd sys
  1283. X+     for i in *.bfm ; do
  1284. X+         j=`basename $i .bfm`
  1285. X+         mv $i $j
  1286. X+         echo restored sys/$j >&2
  1287. X+     done
  1288. X+     exit 0
  1289. X+ fi
  1290. X+ 
  1291. X+ for i in stdio.h time.h string.h sys/types.h ; do
  1292. X+     if egrep '(_SIZE_T|_TIME_T)' $i  > /dev/null || test -r $i.bfm; then
  1293. X+         : do nothing, already there
  1294. X+     else
  1295. X+         echo fixing $i
  1296. X+         sed '/typedef.*[     ]size_t/ {
  1297. X+ i\
  1298. X+ #ifndef _SIZE_T
  1299. X+ i\
  1300. X+ #define _SIZE_T
  1301. X+ a\
  1302. X+ #endif
  1303. X+ }
  1304. X+ /typedef.*[     ]time_t/ {
  1305. X+ i\
  1306. X+ #ifndef _TIME_T
  1307. X+ i\
  1308. X+ #define _TIME_T
  1309. X+ a\
  1310. X+ #endif
  1311. X+ }'        $i > $i.new
  1312. X+         mv $i $i.bfm
  1313. X+         mv $i.new $i
  1314. X+     fi
  1315. X+ done
  1316. X+ 
  1317. X+ if sed 1q stdio.h | grep -s 'ifndef[     ][     ]*FILE' > /dev/null ; then
  1318. X+     : do nothing -- already there.
  1319. X+ else
  1320. X+     echo stdio.h once more ...
  1321. X+     ed stdio.h <<-\EOF
  1322. X+         0a
  1323. X+         #ifndef FILE
  1324. X+         .
  1325. X+         $a
  1326. X+         #endif
  1327. X+         .
  1328. X+         w
  1329. X+ EOF
  1330. X+ fi
  1331. X+ #
  1332. X+ # $Log: fixmin.xenix,v $
  1333. X+ # Revision 1.1  1991/08/22  20:06:32  ronald
  1334. X+ # Initial revision
  1335. X+ #
  1336. X*** xenixld.c
  1337. X--- xenixld.c    Thu Aug 22 21:17:40 1991
  1338. X***************
  1339. X*** 0 ****
  1340. X--- 1,264 ----
  1341. X+ static char rcsid[] = "@(#) $Id: xenixld.c,v 1.2 1991/08/22 20:17:03 ronald Exp $\n";
  1342. X+ /*
  1343. X+  * This is the version distributed by RoboBar limited, currently maintained
  1344. X+  * by Ronald Khoo <ronald@ibmpcug.co.uk>
  1345. X+  *
  1346. X+  * $Log: xenixld.c,v $
  1347. X+  * Revision 1.2  1991/08/22  20:17:03  ronald
  1348. X+  * Baseline for release with GCC 1.40
  1349. X+  * Various mods by Steve, and a hack to prevent loading of COFF files.
  1350. X+  *
  1351. X+  */
  1352. X+ /* Linker driver program for Xenix that can handle gcc command lines
  1353. X+    Copyright (C) 1990 Christoph Badura
  1354. X+ 
  1355. X+    Comments and buggestions are welcome. Write to bad@flatlin.sub.org.
  1356. X+ 
  1357. X+ This file is not part of GNU CC.
  1358. X+ 
  1359. X+ This program is free software; you can redistribute it and/or modify
  1360. X+ it under the terms of the GNU General Public License as published by
  1361. X+ the Free Software Foundation; either version 1, or (at your option)
  1362. X+ any later version.
  1363. X+ 
  1364. X+ This program is distributed in the hope that it will be useful,
  1365. X+ but WITHOUT ANY WARRANTY; without even the implied warranty of
  1366. X+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1367. X+ GNU General Public License for more details.
  1368. X+ 
  1369. X+ You should have received a copy of the GNU General Public License
  1370. X+ along with GNU CC; see the file COPYING.  If not, write to
  1371. X+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  1372. X+ 
  1373. X+ */
  1374. X+ 
  1375. X+ #include <stdio.h>
  1376. X+ 
  1377. X+ #include "config.h"
  1378. X+ 
  1379. X+ #ifdef USG
  1380. X+ #define R_OK 4
  1381. X+ #define W_OK 2
  1382. X+ #define X_OK 1
  1383. X+ #define vfork fork
  1384. X+ #endif /* USG */
  1385. X+ 
  1386. X+ extern void free ();
  1387. X+ 
  1388. X+ /* Default prefixes to attach to command names.  */
  1389. X+ 
  1390. X+ #ifndef STANDARD_STARTFILE_PREFIX
  1391. X+ #define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
  1392. X+ #endif /* !defined STANDARD_STARTFILE_PREFIX */
  1393. X+ 
  1394. X+ char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
  1395. X+ char *standard_startfile_prefix_1 = "/lib/386/";
  1396. X+ char *standard_startfile_prefix_2 = "/usr/lib/";
  1397. X+ 
  1398. X+ char * progname;        /* who am i */
  1399. X+ 
  1400. X+ fatal (char *msg)
  1401. X+ {
  1402. X+     fprintf (stderr, "%s:%s\n", progname, msg);
  1403. X+     exit (1);
  1404. X+ }
  1405. X+ 
  1406. X+ xmalloc (size)
  1407. X+      int size;
  1408. X+ {
  1409. X+   register int value = malloc (size);
  1410. X+   if (!value)
  1411. X+     fatal ("Virtual memory full.");
  1412. X+   return value;
  1413. X+ }
  1414. X+ 
  1415. X+ xrealloc (void *ptr, int size)
  1416. X+ {
  1417. X+   register int value = realloc (ptr, size);
  1418. X+   if (!value)
  1419. X+     fatal ("Virtual memory full.");
  1420. X+   return value;
  1421. X+ }
  1422. X+ 
  1423. X+ struct lib_path {
  1424. X+     struct lib_path *next;
  1425. X+     int    length;            /* length of following string */
  1426. X+     char *path;
  1427. X+ };
  1428. X+ 
  1429. X+ struct lib_path *lib_path;    /* the library search path */
  1430. X+ 
  1431. X+ struct lib_path *
  1432. X+ add_path (char *name, struct lib_path *prev)
  1433. X+ {
  1434. X+     int size;
  1435. X+     struct lib_path *lp;
  1436. X+ 
  1437. X+ #ifdef DEBUG
  1438. X+     fprintf (stderr, "%s: adding %s to library path\n", progname, name);
  1439. X+ #endif
  1440. X+     lp = (struct lib_path *) xmalloc (sizeof (struct lib_path));
  1441. X+     lp->next = prev;
  1442. X+     lp->length = strlen (name);
  1443. X+     lp->path = name;
  1444. X+     return lp;
  1445. X+ }
  1446. X+ 
  1447. X+ /*
  1448. X+  * Added by Ronald.Khoo@ibmpcug.co.uk:
  1449. X+  * SCO systems have two kinds of libraries, OMF and COFF.  XENIX GCC/G++
  1450. X+  * only works with OMF, this hack prevents the program accidentally finding
  1451. X+  * COFF libraries earlier in the search path from the corresponding OMF one.
  1452. X+  */
  1453. X+ int
  1454. X+ islib(char *name)
  1455. X+ {
  1456. X+     int i;
  1457. X+     FILE *fp = fopen(name, "r");
  1458. X+     if (fp == 0)
  1459. X+         return 0;
  1460. X+     i = getw(fp);
  1461. X+     fclose(fp);
  1462. X+     return (i & 0xff) == 0x80 /* OMF */ || (i & 0xffff) == 0xff65 /* ar */;
  1463. X+ }
  1464. X+ 
  1465. X+ char *
  1466. X+ find_library_1 (char *name)
  1467. X+ {
  1468. X+     struct lib_path *lp;
  1469. X+     int name_size, size = 0;
  1470. X+     char *temp_name = 0;
  1471. X+     int win = 0;
  1472. X+ 
  1473. X+     name_size = strlen (name) + 1;
  1474. X+     for (lp=lib_path; lp && !win; lp=lp->next) {
  1475. X+     if ((lp->length + name_size + 1) > size) {
  1476. X+         size = lp->length + name_size + 1;
  1477. X+         if (temp_name)
  1478. X+         free (temp_name);
  1479. X+         temp_name = 0;
  1480. X+     }
  1481. X+     if (!temp_name)
  1482. X+         temp_name = (char *)xmalloc (size);
  1483. X+     strcpy (temp_name, lp->path);
  1484. X+     if (temp_name[lp->length - 1] != '/')
  1485. X+         strcat (temp_name, "/");
  1486. X+     strcat (temp_name, name);
  1487. X+     win = islib(temp_name);
  1488. X+ #ifdef DEBUG
  1489. X+     fprintf (stderr, "%s: searching %s -> %d\n", progname, temp_name, win);
  1490. X+ #endif
  1491. X+     }
  1492. X+     if (win)
  1493. X+     return temp_name;
  1494. X+     else {
  1495. X+     free (temp_name);
  1496. X+     return name;
  1497. X+     }
  1498. X+ }
  1499. X+ 
  1500. X+ char *
  1501. X+ find_library (char *name)
  1502. X+ {
  1503. X+     char *temp_name;
  1504. X+     char *lib_name;
  1505. X+ 
  1506. X+     temp_name = (char *)xmalloc (strlen (name) + 7); /* 6 chars for "Slib" and ".a" */
  1507. X+     strcpy (temp_name, "lib");
  1508. X+     strcat (temp_name, name);
  1509. X+     strcat (temp_name, ".a");
  1510. X+     if ((lib_name = find_library_1 (temp_name)) == temp_name) {
  1511. X+     strcpy (temp_name, "Slib"); /* system libraries start with "Slib" */
  1512. X+     strcat (temp_name, name);
  1513. X+     strcat (temp_name, ".a");
  1514. X+     lib_name = find_library_1 (temp_name);
  1515. X+     }
  1516. X+     free (temp_name);
  1517. X+ #ifdef DEBUG
  1518. X+     fprintf (stderr, "%s: library name is %s\n", progname, lib_name);
  1519. X+     fprintf (stderr, "%s: returning %s\n", progname,
  1520. X+          (lib_name == temp_name) ? name : lib_name);
  1521. X+ #endif
  1522. X+     return (lib_name == temp_name) ? name : lib_name;
  1523. X+ }
  1524. X+ 
  1525. X+ 
  1526. X+ char **argbuf;            /* this holds the argument vector for ld */
  1527. X+ int argbuf_index, argbuf_length;
  1528. X+ 
  1529. X+ /* Add one argument to the vector at the end. */
  1530. X+ 
  1531. X+ void
  1532. X+ store_arg (char *arg)
  1533. X+ {
  1534. X+   if (argbuf_index + 1 == argbuf_length)
  1535. X+     {
  1536. X+       argbuf = (char **) xrealloc (argbuf, (argbuf_length*=2)*sizeof (char *));
  1537. X+     }
  1538. X+ 
  1539. X+   argbuf[argbuf_index++] = arg;
  1540. X+   argbuf[argbuf_index] = 0;
  1541. X+ }
  1542. X+ 
  1543. X+ /*
  1544. X+  * The standard Xenix ld is seriously braindamaged. It does not understand
  1545. X+  * -llib options.  So we expand them here and furthermore we process -Lpath
  1546. X+  * options as used by the GNU tools.
  1547. X+  */
  1548. X+ 
  1549. X+ int
  1550. X+ main (int argc, char **argv)
  1551. X+ {
  1552. X+     int size;
  1553. X+     char *lib_name;
  1554. X+ #ifdef DEBUG
  1555. X+     char **argp;
  1556. X+ #endif
  1557. X+ 
  1558. X+     progname = *argv;
  1559. X+ 
  1560. X+     argbuf_length = 10;
  1561. X+     argbuf_index = 0;
  1562. X+     argbuf = (char **) xmalloc (argbuf_length * sizeof (char *));
  1563. X+ 
  1564. X+     /* push default library search paths on lib_stack */
  1565. X+     lib_path = add_path (standard_startfile_prefix_2, (struct lib_path *)0);
  1566. X+     lib_path = add_path (standard_startfile_prefix_1, lib_path);
  1567. X+     lib_path = add_path (standard_startfile_prefix, lib_path);
  1568. X+ 
  1569. X+     /*
  1570. X+      * Copy argv to argbuf processing -L switches and
  1571. X+      * resolving library names. Preserve the order of the arguments.
  1572. X+      */
  1573. X+     store_arg ("ld"); /* provide argv[0] for ld */
  1574. X+     for (++argv; --argc > 0; ++argv) {
  1575. X+     if ((*argv)[0] == '-')
  1576. X+         switch ((*argv)[1]) {
  1577. X+         case 'L':
  1578. X+         lib_path = add_path ((*argv)+2, lib_path);
  1579. X+         break;
  1580. X+         case 'l':
  1581. X+         lib_name = find_library ((*argv)+2);
  1582. X+ #ifdef DEBUG
  1583. X+         fprintf (stderr, "%s: found library %s\n", progname, lib_name);
  1584. X+ #endif
  1585. X+         store_arg (lib_name);
  1586. X+         break;
  1587. X+         default:
  1588. X+         store_arg (*argv);
  1589. X+         }
  1590. X+     else
  1591. X+         /* just an input file */
  1592. X+         store_arg (*argv);
  1593. X+     }
  1594. X+ #ifdef DEBUG
  1595. X+     fprintf (stderr, "%s: linker call: \"", progname);
  1596. X+     for (argp=argbuf; *argp; argp++)
  1597. X+     fprintf (stderr, "%s ", *argp);
  1598. X+     putc ('\n', stderr);
  1599. X+ #endif
  1600. X+     execv ("/bin/ld", argbuf);
  1601. X+     /* maybe ld is not ld */
  1602. X+     fprintf (stderr, "%s: unable to run /bin/ld", progname);
  1603. X+     exit (1);
  1604. X+ }
  1605. X
  1606. END_OF_FILE
  1607.   if test 41132 -ne `wc -c <'gcc-1.40.pch'`; then
  1608.     echo shar: \"'gcc-1.40.pch'\" unpacked with wrong size!
  1609.   fi
  1610.   # end of 'gcc-1.40.pch'
  1611. fi
  1612. echo shar: End of archive.
  1613. exit 0
  1614. -- 
  1615. Steve.Bleazard@RoboBar.Co.Uk        | Phone:  +44 81 991 1142 x153
  1616. Snr Software Engineer, Robobar Ltd. | Fax:    +44 81 998 8343 (G3)
  1617. 22 Wadsworth Road, Perivale.        |
  1618. Middx., UB6 7JD ENGLAND.            | ...!ukc!robobar!steve
  1619.  
  1620. exit 0 # Just in case...
  1621. -- 
  1622. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1623. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1624. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1625. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1626.